home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / jpi / imprint.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-01-05  |  3.3 KB  |  123 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "Form1"
  4.    ClientHeight    =   4335
  5.    ClientLeft      =   2070
  6.    ClientTop       =   2085
  7.    ClientWidth     =   7080
  8.    LinkTopic       =   "Form1"
  9.    ScaleHeight     =   4335
  10.    ScaleWidth      =   7080
  11.    Begin VB.TextBox Text2 
  12.       Height          =   285
  13.       Left            =   4320
  14.       TabIndex        =   2
  15.       Text            =   "Text2"
  16.       Top             =   2040
  17.       Width           =   2655
  18.    End
  19.    Begin VB.ListBox List1 
  20.       Height          =   1815
  21.       Left            =   4320
  22.       TabIndex        =   1
  23.       Top             =   120
  24.       Width           =   2655
  25.    End
  26.    Begin VB.PictureBox Picture1 
  27.       Height          =   4095
  28.       Left            =   120
  29.       ScaleHeight     =   269
  30.       ScaleMode       =   3  'Pixel
  31.       ScaleWidth      =   269
  32.       TabIndex        =   0
  33.       Top             =   120
  34.       Width           =   4095
  35.    End
  36. Attribute VB_Name = "Form1"
  37. Attribute VB_GlobalNameSpace = False
  38. Attribute VB_Creatable = False
  39. Attribute VB_PredeclaredId = True
  40. Attribute VB_Exposed = False
  41. Private Const Msg = "ION FORMAT VERSION: 1.0"
  42. Private Sub Form_Load()
  43. Call LoadStuff
  44. Call UpdateList
  45. List1.ListIndex = 0
  46. End Sub
  47. Sub LoadStuff()
  48. On Error GoTo Errr:
  49. Open "ObjectImprints.Dat" For Input As #1
  50. Line Input #1, a$
  51.   Line Input #1, a$
  52.   If a$ = "[ENDOFFILE]" Then Exit Do
  53.   If a$ = "[OBJIMPRINT]" Then
  54.     Currimp = Currimp + 1
  55.     Line Input #1, a$
  56.     Temps(Currimp).Name = a$
  57.     For X = 1 To 10
  58.       For Y = 1 To 10
  59.         Line Input #1, a$
  60.         Temps(Currimp).TemplateArray(X, Y) = Val(a$)
  61.       Next Y
  62.     Next X
  63.   End If
  64. Errr:
  65. Close #1
  66. End Sub
  67. Sub SaveStuff()
  68. Open "ObjectImprints.Dat" For Output As #1
  69. Print #1, Msg
  70. For i = 1 To 80
  71.   Print #1, "[OBJIMPRINT]"
  72.   Print #1, Temps(i).Name
  73.   For X = 1 To 10
  74.     For Y = 1 To 10
  75.       If Temps(i).TemplateArray(X, Y) = True Then
  76.         Print #1, -1
  77.       Else
  78.         Print #1, 0
  79.       End If
  80.     Next Y
  81.   Next X
  82.   Print #1, "[ENDOBJIMPRINT]"
  83. Next i
  84. Print #1, "[ENDOFFILE]"
  85. Close #1
  86. End Sub
  87. Private Sub Form_Unload(Cancel As Integer)
  88. Call SaveStuff
  89. End Sub
  90. Private Sub List1_Click()
  91. CurrentTemp = List1.ListIndex + 1
  92. Call DrawTemplate(CurrentTemp)
  93. Text2.Text = Temps(CurrentTemp).Name
  94. End Sub
  95. Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  96. On Error Resume Next
  97. X1 = Int((X / BSize) + 1)
  98. Y1 = Int((Y / BSize) + 1)
  99. If Button = 1 Then
  100.   Temps(CurrentTemp).TemplateArray(X1, Y1) = True
  101.   Call DrawTemplate(CurrentTemp)
  102. ElseIf Button = 2 Then
  103.   Temps(CurrentTemp).TemplateArray(X1, Y1) = False
  104.   Call DrawTemplate(CurrentTemp)
  105. End If
  106. End Sub
  107. Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  108. On Error Resume Next
  109. X1 = Int((X / BSize) + 0.5)
  110. Y1 = Int((Y / BSize) + 0.5)
  111. If Button = 1 Then
  112.   Temps(CurrentTemp).TemplateArray(X1, Y1) = True
  113.   Call DrawTemplate(CurrentTemp)
  114. ElseIf Button = 2 Then
  115.   Temps(CurrentTemp).TemplateArray(X1, Y1) = False
  116.   Call DrawTemplate(CurrentTemp)
  117. End If
  118. End Sub
  119. Private Sub Text2_KeyUp(KeyCode As Integer, Shift As Integer)
  120. Temps(CurrentTemp).Name = Text2.Text
  121. List1.List(CurrentTemp - 1) = Text2.Text
  122. End Sub
  123.